<?php
define('NONUSER', true);
require 'core/bootstrap.php';
$action = $request->getActionName();
switch ($action){
	case 'captcha':
		require CB_INCLUDE.'captcha.class.php';
		$font = CB_DATA . 'fonts/arial.ttf';
        $captcha = new captcha($font);
        $captcha->OutputImg();
		break;
	case 'user-exist':
		$username = trim($request->getParam('username'));
		$user = $cbdb->get_row('SELECT * FROM {#cbdbPrefix}members WHERE username="'.$username.'" LIMIT 0,1');
		if($user)
			echo 'yes';
		else
			echo 'no';
		break;
	case 'email-exist':
		$email = trim($request->getParam('email'));
		$user = $cbdb->get_row('SELECT * FROM {#cbdbPrefix}members WHERE email="'.$email.'" LIMIT 0,1');
		if($user)
			echo 'yes';
		else
			echo 'no';
		break;
	case 'check-captcha':
		$code = trim($request->getParam('code'));
		if(md5($code) == $_SESSION['AuthCode'])
			echo 'yes';
		else
			echo 'no';
		break;
	default:
		break;
}